import { MockMethod } from 'vite-plugin-mock';
import { resultSuccess } from '../_util';
import { mock } from 'mockjs';

const levelList = mock({
  'data|30': [
    {
      levelId: 1,
      levelName: '普通会员',
      growth: '0.00',
      bgColor: '#333',
      status: 1,
      levelBackground: '',
      levelTextColor: '',
      levelImage: '',
      levelVip: 'VIP1',
      is_default: 1,
      //等级权益
      consumeDiscount: '100.00',
      pointFeedback: 1.2,
      //等级礼包
      send_point: 0,
      send_balance: '0.00',
      send_coupon: '',
      // 会员人数
      memberNum: 100,
    },
  ],
});

const levelInfo = mock({
  levelId: '@increment',
  levelName: 'CONVERSE匡威官方 All Star时尚百搭帆布鞋女鞋新款休闲鞋571867C',
  introduction: '时尚百搭帆布鞋女鞋新款休闲鞋571867C',
  levelImageList: [
    'http://www.lvais.com/upload/2022/11/15/20221115112138641.jpg',
    'http://www.lvais.com/upload/2019/08/07/20190807100514186.jpg',
  ],
  keyword: '是客户交,深刻的回复',
  categoryId: [1, 2, 3],
  levelState: 2,
  price: '499.00',
  levelStock: 400,
  levelStockAlarm: 0,
  createTime: '@date(yyyy-MM-dd HH:mm:ss)',
  saleNum: 0,
  isVirtual: 0,
  levelClass: 1,
  levelClassName: '实物商品',
  isFenxiao: 0,
  fenxiaoType: 1,
  promotionAddon: '',
  skuId: 15,
  isConsumeDiscount: 0,
  discountConfig: 0,
  discountMethod: '',
  sort: '@integer(1,20)',
  labelId: 0,
  labelName: '',
  isDelete: 0,
  virtualDeliverType: '',
  //新增
  levelStateText: '销售中',
});

export default [
  //分页
  {
    url: '/mock-api/v1/member/level/page',
    timeout: 100,
    method: 'post',
    response: () => {
      return resultSuccess({ list: levelList.data.slice(0, 8), total: 10 });
    },
  },
  {
    url: '/mock-api/v1/member/level/info',
    timeout: 100,
    method: 'post',
    response: () => {
      return resultSuccess(levelInfo);
    },
  },
] as MockMethod[];
